﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/PagePlaceMaster.Master"
    Inherits="System.Web.Mvc.ViewPage<RegisterModel>" %>

<asp:Content ID="Content2" ContentPlaceHolderID="HeadPlaceHolder" runat="server">
    <link rel="Stylesheet" type="text/css" href="/Content/css/login.css" />
    <style type="text/css">
        .validatefault{ border:2px solid red; }
        .validatefaulttext{ color:Red;}
    </style>
    <script type="text/javascript">
        function usernamevalidate() {
            var ele = $('#txtusername');
            var val = ele.val();
            var reg = new RegExp('.+?@\.');
            if (reg.test(val)) {
                $.get('/Account/CheckUserUnique?username=' + val, {}, function (result) {
                    if (result == '1') {
                        addfaultstyle(ele, '该用户名已经存在');
                        ele.focus();
                        return false;
                    }
                    else {
                        removefaultstyle(ele);
                    }
                });
            }
            else {
                addfaultstyle(ele, '用户名应该为邮箱格式');
                return false;
            }
        }
        function passwordvalidate() {
            var self = $('#txtpwd');
            var o = $('#txtrepwd');
            if (o.val() != '' && self.val() != o.val()) {
                addfaultstyle(self, '两次输入不一致');
                addfaultstyle(o, '两次输入不一致');
                self.focus();
                o.focus();
                return false;
            }
            else {
                removefaultstyle(self);
                removefaultstyle(o);
            }
        }
        function repasswordvalidate() {
            var self = $('#txtrepwd');
            var o = $('#txtpwd');
            if (self.val() == '' || o.val() == '' || self.val() != o.val()) {
                addfaultstyle(self, '两次输入不一致');
                addfaultstyle(o, '两次输入不一致');
                self.focus();
                o.focus();
                return false;
            }
            else {
                removefaultstyle(self);
                removefaultstyle(o);
            }
        }
        function nicknamevalidate() {
            var self = $('#txtnickname');
            if (self.val() == '') {
                addfaultstyle(self, '(必填)');
                self.focus();
                return false;
            }
            else {
                removefaultstyle(self);
            }
        }
        function appellactionvalidate() {
            var self = $('#txtappla');
            if (self.val() == '') {
                addfaultstyle(self, '(必填)');
                self.focus();
                return false;
            }
            else {
                removefaultstyle(self);
            }
        }
        function birthdayvalidate() {
            var self = $('#txtbirthday');
            var reg = new RegExp('^\\d{4}\\.\\d{1,2}\\.\\d{1,2}$');
            if (!reg.test(self.val())) {
                addfaultstyle(self, '格式错误，例：1985.10.01');
                self.focus();
                return false;
            }
            else {
                removefaultstyle(self);
            }
        }
        $(function () {
            $('#txtusername').blur(function () {
                usernamevalidate();
            });
            $('#txtpwd').blur(function () {
                passwordvalidate();
            });
            $('#txtrepwd').blur(function () {
                repasswordvalidate();
            });
            $('#txtnickname').blur(function () {
                nicknamevalidate();
            });
            $('#txtappla').blur(function () {
                appellactionvalidate();
            });
            $('#txtbirthday').blur(function () {
                birthdayvalidate();
            });
            $('#regform').submit(function () {
                if (!usernamevalidate()) return false;
                if (!passwordvalidate()) return false;
                if (!repasswordvalidate()) return false;
                if (!nicknamevalidate()) return false;
                if (!appellactionvalidate()) return false;
                if (!birthdayvalidate()) return false;
                return true;
            });
        });
        function addfaultstyle(ele, errortext) {
            $(ele).parent().addClass('validatefault');
            $(ele).siblings('.notes').css({ 'color': 'red' }).text(errortext);
            //
        }
        function removefaultstyle(ele) {
            $(ele).parent().removeClass('validatefault');
            $(ele).siblings('.notes').css({ 'color': '' }).text('');
        }
    </script>
</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    <!-- breadcrumbs -->
    <div class="breadcrumbs">
        <div class="shell">
            <p>
                感谢有你，您的利益是我们不断努力的动力</p>
            <h2>
                新用户注册</h2>
        </div>
    </div>
    <!-- end breadcrumbs -->
    <!-- main -->
    <div id="main">
        <div class="shell">
            <div class="reg_box">
                <div class="reg_list">
                    <div class="normalform">
                    <form id="regform" action="/Account/Register" method="post">
                        <div class="item">
                            <div>
                            <label class="lab">
                                用户名(邮箱)：</label>
                            <input class="tx_ipt" id="txtusername" name="username"/>
                            <span class="cues notes">(必填) 格式：xxx@xxx.com</span>
                            </div>
                        </div>
                        <div class="item">
                            <div>
                            <label class="lab">
                                密码：</label>
                            <input type="password" id="txtpwd" name="password" class="tx_ipt" />
                            <span class="cues notes"></span>
                            </div>
                        </div>
                        <div class="item">
                            <div>
                            <label class="lab">
                                确认密码：</label>
                            <input type="password" id="txtrepwd" class="tx_ipt" />
                            <span class="cues notes"></span>
                            </div>
                        </div>
                        <div class="item">
                            <div>
                            <label class="lab">
                                昵称：</label>
                            <input class="tx_ipt" id="txtnickname" name="nickname" maxlength="10" />
                            <span class="cues notes">(必填)</span>
                            </div>
                        </div>
                        <div class="item">
                            <div>
                            <label class="lab">
                                称谓：</label>
                            <input type="text" class="tx_ipt" id="txtappla" name="appellaction" />
                            <span class="cues notes">我们该怎么称呼您？</span>
                            </div>
                        </div>
                        <div class="item">
                            <label class="lab">
                                性别：</label>
                            <span>
                                <input name="sex" type="radio" value="0" class="ched" checked="checked" />男<input name="sex"
                                    class="ched" type="radio" value="1" />女</span>
                            <span class="cues notes"></span>
                        </div>
                        <div class="item">
                            <div>
                            <label class="lab">
                                出生日期：</label>
                            <input type="text" class="tx_ipt" id="txtbirthday" name="birthday" />
                            <span class="cues">格式：1985.10.1</span>
                            </div>
                        </div>
                        <div class="item">
                            <label class="lab">
                                联系方式：</label>
                            <input class="tx_ipt" type="text" name="contact" />
                            <span class="cues">(选填) 例：（手机）130xxxxxxxx</span>
                        </div>
                        <div class="item">
                            <label class="lab">
                                现所在地址：</label>
                            <input class="tx_ipt" type="text" name="address" />
                            <span class="cues">(选填)</span>
                        </div>
                        <div class="item">
                            <label class="lab">
                                立即开通网站：</label>
                            <input type="checkbox" name="opensite" id="ckbopensite" />
                            <label for="ckbopensite" class="cues">立即开通网站</label>
                            <span class="cues"></span>
                        </div>
                        <div class="item nober">
                            <button id="btn_regist" class="btn_in" type="reset">
                                重新填写</button>
                        </div>
                        <div class="item nober">
                            <button id="btn_regist1" class="btn_in" type="submit">
                                完成</button>
                        </div>
                    </form>
                    </div>
                </div>
                <div class="right_content">
                    <div class="entry_reg">
                        <h2 class="title11">
                            新闻公告</h2>
                        <ul class="list_public">
                            <li><a href="javascript:;">怎样注册域名?</a></li>
                            <li><a href="javascript:;">怎样做域名解析?</a></li>
                            <li><a href="javascript:;">怎样申请虚拟主机?</a></li>
                            <li><a href="javascript:;">怎样管理已购买的空间?</a></li>
                            <li><a href="javascript:;">怎样用FTP软件上传文件?</a></li>
                            <li><a href="javascript:;">常见错误及处理方法</a></li>
                            <li><a href="javascript:;">新客户网站备案</a></li>
                            <li><a href="javascript:;">关于新备案系统需要注意地方</a></li>
                            <li><a href="javascript:;">域名管理中心</a></li>
                            <li><a href="javascript:;">空间管理中心</a></li>
                        </ul>
                    </div>
                </div>
                <p class="clear">
                </p>
            </div>
        </div>
    </div>
    <!-- end main -->
    <!-- footer push -->
    <div id="footer-push" class="notext">
        &nbsp;</div>
    <!-- end footer push -->
</asp:Content>
